home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / vidhrdw / sharkatt.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  3KB  |  102 lines

  1. /***************************************************************************
  2.  
  3.   vidhrdw.c
  4.  
  5.   Functions to emulate the video hardware of the machine.
  6.  
  7. ***************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11.  
  12. static int color_plane = 0;
  13.  
  14. /***************************************************************************
  15.  sharkatt_vtcsel_w
  16.  
  17.  TODO:  This writes to a TMS9927 VTAC.  Do we care?
  18.  **************************************************************************/
  19. WRITE_HANDLER( sharkatt_vtcsel_w )
  20. {
  21. }
  22.  
  23. /***************************************************************************
  24.  sharkatt_color_plane_w
  25.  **************************************************************************/
  26. WRITE_HANDLER( sharkatt_color_plane_w )
  27. {
  28.     /* D0-D3 = WS0-WS3, D4-D5 = RS0-RS1 */
  29.     /* RS = CPU Memory Plane Read Multiplex Select */
  30.     color_plane = (data & 0x3F);
  31. }
  32.  
  33. /***************************************************************************
  34.  sharkatt_color_map_w
  35.  **************************************************************************/
  36. WRITE_HANDLER( sharkatt_color_map_w )
  37. {
  38.     int vals[4] = {0x00,0x55,0xAA,0xFF};
  39.     int r,g,b;
  40.  
  41.     r = vals[(data & 0x03) >> 0];
  42.     g = vals[(data & 0x0C) >> 2];
  43.     b = vals[(data & 0x30) >> 4];
  44.     palette_change_color (offset,r,g,b);
  45. }
  46.  
  47. /***************************************************************************
  48.  sharkatt_videoram_w
  49.  **************************************************************************/
  50. WRITE_HANDLER( sharkatt_videoram_w )
  51. {
  52.     int i,x,y;
  53.  
  54.  
  55.     videoram[offset] = data;
  56.  
  57.     x = offset / 32;
  58.     y = 8 * (offset % 32);
  59.  
  60.     for (i = 0;i < 8;i++)
  61.     {
  62.         int col;
  63.  
  64.         col = Machine->pens[color_plane & 0x0F];
  65.  
  66.         if (data & 0x80)
  67.         {
  68.             plot_pixel2(tmpbitmap, Machine->scrbitmap, x, y, col);
  69.         }
  70.         else
  71.         {
  72.             plot_pixel2(tmpbitmap, Machine->scrbitmap, x, y, Machine->pens[0]);
  73.         }
  74.  
  75.         y++;
  76.         data <<= 1;
  77.     }
  78. }
  79.  
  80.  
  81. /***************************************************************************
  82.  
  83.   Draw the game screen in the given osd_bitmap.
  84.   Do NOT call osd_update_display() from this function, it will be called by
  85.   the main emulation engine.
  86.  
  87. ***************************************************************************/
  88. void sharkatt_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
  89. {
  90.     if (palette_recalc())
  91.     {
  92.         int offs;
  93.  
  94.         for (offs = 0;offs < videoram_size;offs++)
  95.             sharkatt_videoram_w(offs,videoram[offs]);
  96.     }
  97.  
  98.     if (full_refresh)
  99.         /* copy the character mapped graphics */
  100.         copybitmap(bitmap,tmpbitmap,0,0,0,0,&Machine->drv->visible_area,TRANSPARENCY_NONE,0);
  101. }
  102.